--处理打分的lua
session:consoleLog("info","进入打分");
local callnum=session:getVariable("caller_id_number");
local sessionuuid=session:getVariable("uuid");

local count=3;
local isbreak=0;
while(session:ready() ==true and  count > 0)do

	local digit=session:playAndGetDigits(1, 1, 1, 1000, "#",
        "/usr/local/freeswitch/sounds/score.wav",
	"",
         "(.)+");
	
	
	if(digit == "1")  then
		session:consoleLog("info","好评");
		isbreak=1;
	end

	if(digit == "0") then
		session:consoleLog("info","差评")
		isbreak=1;
	end;


	if(isbreak == 1) then
		
		local event = freeswitch.Event("CUSTOM", "NECO:CC_SCORE");
		event:addHeader("Caller-Orig-Caller-ID-Number",callnum);
		event:addHeader("Score-Digit",digit);
		event:addHeader("Unique-ID",sessionuuid);
		event:fire();
		return "break";
	end

	count=count-1;

end
